# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.ResultSetStats do
  @moduledoc """
  Additional statistics about a ResultSet or PartialResultSet.

  ## Attributes

  *   `queryPlan` (*type:* `GoogleApi.Spanner.V1.Model.QueryPlan.t`, *default:* `nil`) - QueryPlan for the query associated with this result.
  *   `queryStats` (*type:* `map()`, *default:* `nil`) - Aggregated statistics from the execution of the query. Only present when the query is profiled. For example, a query could return the statistics as follows: { "rows_returned": "3", "elapsed_time": "1.22 secs", "cpu_time": "1.19 secs" }
  *   `rowCountExact` (*type:* `String.t`, *default:* `nil`) - Standard DML returns an exact count of rows that were modified.
  *   `rowCountLowerBound` (*type:* `String.t`, *default:* `nil`) - Partitioned DML doesn't offer exactly-once semantics, so it returns a lower bound of the rows modified.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :queryPlan => GoogleApi.Spanner.V1.Model.QueryPlan.t() | nil,
          :queryStats => map() | nil,
          :rowCountExact => String.t() | nil,
          :rowCountLowerBound => String.t() | nil
        }

  field(:queryPlan, as: GoogleApi.Spanner.V1.Model.QueryPlan)
  field(:queryStats, type: :map)
  field(:rowCountExact)
  field(:rowCountLowerBound)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.ResultSetStats do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.ResultSetStats.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.ResultSetStats do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
